<template>
  <view class="wrap">
    <u-form class="login-form" :model="model" :rules="rules" ref="uForm" label-width="100" >
      <u-form-item label="学号">
        <u-input :border="border" v-model="model.stu_no" type="text"></u-input>
      </u-form-item>

      <u-form-item label="密码">
        <u-input :border="border" v-model="model.password" type="password"></u-input>
      </u-form-item>
    </u-form>
    <u-button class="custom-btn" type="primary" @click="submit">提交</u-button>
  </view>
</template>

<script>
export default {
  data() {
    let that = this;
    return {
      model: {},
      rules: {},
      border: true,
      check: false,
      selectStatus: 'close',
    };
  },
  onLoad() {

  },
  created() {
    console.log(1)
  },
  computed: {},
  onReady() {
    this.$refs.uForm.setRules(this.rules);
  },
  methods: {
    submit() {
      let that = this
      this.$u.post('/student/login', this.model).then(res => {
        uni.showToast({
          title: '登录成功',
          duration: 2000
        })
        that.$u.vuex('vuex_user', res)
        uni.switchTab({
          url: '/pages/example/template'
        })
        console.log(11111)
      })
    },
  }
};
</script>

<style scoped lang="scss">
.wrap {
  padding: 30 rpx;
}

.agreement {
  display: flex;
  align-items: center;
  margin: 40 rpx 0;

  .agreement-text {
    padding-left: 8 rpx;
    color: $u-tips-color;
  }
}
.login-form{
	margin: 0 auto;
	width: calc(90% - 80rpx);
	border: #F0F0F0 2px solid;
	border-radius: 10px;
	padding: 40rpx;
	color: #2A2D41;
	margin-top: 50rpx;
}
.custom-btn{
	margin-top: 40rpx;
}
</style>
